﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AskPro.Models.DataContext;

namespace AskPro.Models.Repositories
{
    public abstract class RepositoryBase
    {
        public Guid GetUserId()
        {
            var principal = HttpContext.Current.User as MyPrincipal;

            if (principal == null)
            {
                throw new FieldAccessException("Could not access the principal!");
            }

            Guid userId = principal.DbUser.UserId;
            
            return userId;
        }
    }
}